package operation;

import Dao.MilkDao;
import interfac.MilkTeaOperation;
import pojo.MilkTeaProduct;
import java.util.List;
import java.util.Scanner;

public class ShowMilkTeaOperation implements MilkTeaOperation {
    @Override
    public void execute(Scanner scanner) {
        MilkDao milkDao = new MilkDao();
        List<MilkTeaProduct> allProducts = milkDao.getProducts();

        if (!allProducts.isEmpty()) {
            System.out.println("----- 奶茶产品列表 -----");
            for (MilkTeaProduct product : allProducts) {
                System.out.printf("ID: %d, 名称: %s, 价格: %.2f, 库存: %d%n",
                product.getProduct_id(), product.getProduct_name(),
                product.getPrice(), product.getStock());
            }
            System.out.println("----------------------");
        } else {
            System.out.println("没有找到任何奶茶产品记录。");
        }
    }
}